package cn.tedu.cs.baking.response;

import lombok.Data;

@Data
public class JsonResult {
    //状态码
    private int code;
    //状态消息
    private String message;
    //返回数据对象
    private Object data;

    public JsonResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    //返回默认状态码, 数据对象
    public JsonResult(Object data) {
        this.code = AppCode.SUCCESS.getCode();
        this.message = AppCode.SUCCESS.getMsg();
        this.data = data;
    }

    //返回指定状态码,数据对象
    public JsonResult(AppCode appCode, Object data) {
        this.code = appCode.getCode();
        this.message = appCode.getMsg();
        this.data = data;
    }
}
